package at.ac.tuwien.dse.health.entity;

import javax.persistence.*;
import java.util.Date;

/**
 * {@link User} that consumes services in a {@link Hospital}.
 *
 * @author Bernhard Nickel
 * @author Gregor Schauer
 * @author Dominik Strasser
 */
@Entity
@NamedQueries(
		{@NamedQuery(name = Patient.VALIDATE_SOCIAL_SECURITY_NUMBER,query = "SELECT p FROM Patient p WHERE p.socialSecurityNumber=:socialSecurityNumber")}
)
public class Patient extends User {
	public static final String VALIDATE_SOCIAL_SECURITY_NUMBER="Patient#validateSocialSecurityNumber";
	private Boolean privateInsurance = false;
	private Integer socialSecurityNumber;
	private Date dateOfBirth;
	private Location location;

	@Basic(optional = false)
	public Boolean getPrivateInsurance() {
		return privateInsurance;
	}

	public void setPrivateInsurance(Boolean privateInsurance) {
		this.privateInsurance = privateInsurance;
	}

	@Basic(optional = false)
	public Integer getSocialSecurityNumber() {
		return socialSecurityNumber;
	}

	public void setSocialSecurityNumber(Integer socialSecurityNumber) {
		this.socialSecurityNumber = socialSecurityNumber;
	}

	@Basic(optional = false)
	@Temporal(TemporalType.DATE)
	public Date getDateOfBirth() {
		return dateOfBirth;
	}

	public void setDateOfBirth(Date dateOfBirth) {
		this.dateOfBirth = dateOfBirth;
	}

	@Embedded
	public Location getLocation() {
		return location;
	}

	public void setLocation(Location location) {
		this.location = location;
	}
}
